# Maintainer: Ivan Semkin (ivan at semkin dot ru)

pkgname=net-cpp-git
_pkgname=net-cpp
pkgver=r141.09cac6a
pkgrel=2
pkgdesc='A simple yet beautiful networking API for C++11'
url='https://github.com/ubports/net-cpp'
arch=(x86_64 i686 armv7h aarch64)
license=(LGPL)
conflicts=(net-cpp)
provides=(net-cpp)
depends=(boost process-cpp gmock graphviz properties-cpp jsoncpp python2-flask-script python2-flask python2-decorator python2-simplejson curl)
makedepends=(git cmake cmake-extras-git doxygen bsdiff)
source=('git+https://github.com/ubports/net-cpp.git'
        'Python.patch'
        'HTTPBin.patch')
sha256sums=('SKIP'
            '36b25f932cca5c3e80882424c0884d0ee03774dd8df9ae243163af0417ac7f86'
            '1ae39a76834511a49712a88c415f7411cde4fbe480e687e0879ece9448885549')

prepare() {
  cd ${_pkgname}
  git checkout bionic
  
  patch -Np1 -i "${srcdir}/Python.patch"
  
  cp tests/httpbin.tar.bz2 tests/httpbin.tar.bz2.old
  bspatch tests/httpbin.tar.bz2.old tests/httpbin.tar.bz2 "${srcdir}/HTTPBin.patch"
}

pkgver() {
  cd ${_pkgname}
  echo "r$(git rev-list --count HEAD).$(git describe --always)"
}

build() {
  cd ${_pkgname}
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR="lib/" .
  make
}

check() {
  cd ${_pkgname}
  make ARGS+="--output-on-failure" test
}

package() {
  cd ${_pkgname}
  make DESTDIR="${pkgdir}/" install
}
# vim:set ts=2 sw=2 et:
